#ifndef __CMDLINE_H__
#define __CMDLINE_H__

typedef enum {
    ARG_TYPE_NONE,
    ARG_TYPE_INT,
    ARG_TYPE_STR,

    ARG_TYPE_CNT
} arg_t;

typedef struct {
    const char* name;
    int         cmd;
    arg_t       type;
    void* addr;
    int       (*call)(char* optarg);
    const char* help;
} cmd_item_stru;

#define CFG_ITEM(_name, _cmd, _type, _addr, _call, _help) \
    { .name = _name, .cmd = _cmd, .type = _type, .addr = _addr, .call = _call, .help = _help, }
extern int cmdline(int argc, const char* argv[], cmd_item_stru* table, int cnt, int* poptind);
extern void cmdline_help(cmd_item_stru* table, int cnt, char* msg);
#endif
